package com.wnxy.gym.vevue.core.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wnxy.gym.vevue.core.entity.Stadium;
import com.wnxy.gym.vevue.core.service.IStadiumService;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jack
 * @since 2022-06-14
 */
@RestController
@RequestMapping("/stadium")
public class StadiumController {
    @Autowired
    private IStadiumService stadiumService;

    @GetMapping()
    public List<Stadium> getStadium(){
        List<Stadium> list = stadiumService.getEntity();
        return list;
    }
    //根据条件查询
    @GetMapping("page")
    public IPage<List<Stadium>> getinfos(@RequestParam Integer pageNum,
                                  @RequestParam Integer pageSize,
                                  @RequestParam(required = false)Long placeId,
                                  @RequestParam(required = false)String  placeName
                                  ){

        IPage<List<Stadium>> info = stadiumService.getInfo(new Page(pageNum, pageSize), placeId, placeName);
                    return info;

    }

}

